﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            // 确保绑定数据并解析 ResolveUrl
            this.DataBind();
        }
        // 获取当前请求的页面名（不包括扩展名）
        string currentPage = System.IO.Path.GetFileNameWithoutExtension(Request.Url.AbsolutePath);

        // 根据当前页面名设置导航栏的active状态
        if (currentPage == "Default")
        {
            ElderlyInfoLink.Attributes["class"] = "active";
        }
        else if (currentPage == "people")
        {
            ProfileLink.Attributes["class"] = "active";
        }
        else if (currentPage == "Alerts")
        {
            AlertsLink.Attributes["class"] = "active";
        }
        else if (currentPage == "UserActivityLog")
        {
            UserActivityLogLink.Attributes["class"] = "active";
        }
    }
}
  
